﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true" Inherits="System.Web.Mvc.ViewPage<PortalSite>" %>
<asp:Content ID="Head1" ContentPlaceHolderID="Head" runat="server">
    <% this.Title = JSC.Portal.Web.App.Resources.Msg.PortalSiteManagement;  %>
    <script type="text/javascript">
    $(function() {
        $("#ValidFrom").datepicker($.extend({}, $.datepicker.regional["nl"], { showStatus: true, showOn: "both" }));
        $("#ValidTill").datepicker($.extend({}, $.datepicker.regional["nl"], { showStatus: true, showOn: "both" }));
        $("#gridsitelicense").flexigrid({
            usepager: false, title: "<%= JSC.Portal.Web.App.Resources.Msg.License %>", useRp: false, height: 100
        });
    });
    
    $(document).ready(function() {
        $("#formulier").validate(
        {
            rules:
            {
                Name: "required",
                Url: "required",
                DefaultLanguage: "required",
                DefaultTemplate: "required",
                confirm_webmastermail: {
                    required: true,
                    equalTo: '#WebmasterMail'
                },
                WebmasterMail: {
                    required: true,
                    email: true
                },
                ValidFrom: "required"
            },
            messages:
            {
                Name: "*",
                Url: "*",
                DefaultLanguage: "*",
                DefaultTemplate: "*",
                WebmasterMail: '*',
                confirm_webmastermail: {
                    required: '*',
                    equalTo: '<%= string.Format(JSC.Portal.Web.App.Resources.Msg.XEqualToAbove, JSC.Portal.Web.App.Resources.Msg.EMail.ToLower()) %>'
                },
                ValidFrom: "*"
            }
        });
    });
    
    function Delete() {
        if (confirm('<%= JSC.Portal.Web.App.Resources.Msg.AreYouSureYouWantToDeleteThis %>')) {
            window.location = '<%= Url.Action("Delete", new { id = ViewData.Model.Id }) %>';
        }
    }
</script>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <form id="formulier" method="post" action="<%= Url.Action("SaveOrUpdate", new { id = ViewData.Model.Id }) %>">
    <fieldset class="contentfieldset">
        <legend><%= JSC.Portal.Web.App.Resources.Msg.General %></legend>
        <table border="0">
            <% Html.RenderPartial("DescriptiveEntityEditControl"); %>
            <tr>
                <td class="tdCaption">
                    <%= JSC.Portal.Web.App.Resources.Msg.DefaultLanguage %>
                </td>
                <td>
                    <%= Html.DropDownListFor(model => model.DefaultLanguage, (SelectList)ViewData["Languages"], JSC.Portal.Web.App.Resources.Msg.PleaseMakeAChoice)%>
                </td>
            </tr>
            <tr>
                <td class="tdCaption">
                    <%= JSC.Portal.Web.App.Resources.Msg.Url %>
                </td>
                <td>
                    <%= Html.TextBoxFor(model => model.Url) %>
                </td>
            </tr>
            <tr>
                <td class="tdCaption">
                    <%= JSC.Portal.Web.App.Resources.Msg.WebmasterMail %>
                </td>
                <td>
                    <%= Html.TextBoxFor(model => model.WebmasterMail)%>
                </td>
            </tr>
            <tr>
                <td class="tdCaption">
                    <%= JSC.Portal.Web.App.Resources.Msg.Confirm %>
                </td>
                <td>
                    <%= Html.TextBox("confirm_webmastermail") %>
                </td>
            </tr>
            <tr>
                <td class="tdCaption">
                    <%= JSC.Portal.Web.App.Resources.Msg.Template %>
                </td>
                <td>
                    <%= Html.DropDownListFor(model => model.DefaultTemplate.Id, (SelectList)ViewData["Templates"], JSC.Portal.Web.App.Resources.Msg.PleaseMakeAChoice)%>
                </td>
            </tr>
            <tr>
                <td class="tdCaption">
                    <%= JSC.Portal.Web.App.Resources.Msg.MetaKeywords %>
                </td>
                <td>
                    <%= Html.TextAreaFor(model => model.MetaKeywords, 3, 100, null)%>
                </td>
            </tr>
            <tr>
                <td class="tdCaption">
                    <%= JSC.Portal.Web.App.Resources.Msg.MetaDescription %>
                </td>
                <td>
                    <%= Html.TextAreaFor(model => model.MetaDescription, 3, 100, null)%>
                </td>
            </tr>
            <% Html.RenderPartial("ValidEditControl"); %>
        </table>
    </fieldset>
    <table id="gridsitelicense">
        <thead>
            <tr>
                <th width="250"><%= JSC.Portal.Web.App.Resources.Msg.ModuleType %></th>
                <th width="100"><%= JSC.Portal.Web.App.Resources.Msg.License %></th>
            </tr>
        </thead>
        <tbody>
            <%foreach (SiteLicense sl in ((IList<SiteLicense>)ViewData["SiteLicenses"])) { %>
                <tr>
                    <td><%= Html.Encode(sl.LicensedModule.Name)%></td>
                    <td><%= Html.CheckBox("selectedModules", sl.LicensedModule.Id.ToString(), sl.Licensed)%></td>
                </tr>
            <%}%>
        </tbody>
    </table>
    <div class="button-bar-right">
        <%= Html.LinkButtonRight(JSC.Portal.Web.App.Resources.Msg.Cancel, Url.Action("List"))%>
        <%= Html.SeperatorRight() %>
        <% if (ViewData.Model.CanCreatePortalPage) { %>
        <%= Html.LinkButtonRight(JSC.Portal.Web.App.Resources.Msg.CreateRootPage, Url.Action("CreatePage", ControllerNames.PORTALPAGES_CONTROLLER, new { id = ViewData.Model.Id }))%>
        <% } %>
        <%= Html.SeperatorRight() %>
        <% if (ViewData.Model.CanDelete) { %>
        <%= Html.LinkButtonRight(JSC.Portal.Web.App.Resources.Msg.Delete, "javascript:Delete()")%>
        <% } %>
        <%= Html.SeperatorRight() %>
        <%= Html.SubmitButtonRight(JSC.Portal.Web.App.Resources.Msg.Save)%>
    </div>
</form>
</asp:Content>
